package com.rc.saas.tenant.controller.hlht;

import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.base.WebPageInfo;
import com.rc.saas.tenant.model.hlht.HlhtTenantOpenfor;
import com.rc.saas.tenant.search.hlht.HlhtTenantOpenforSearch;
import com.rc.saas.tenant.service.hlht.HlhtTenantOpenforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create by Yang on 2021/6/23
 */
@Controller
@RequestMapping("/hlhtTenantOpenfor")
public class HlhtTenantOpenforController {

    @Autowired
    private HlhtTenantOpenforService hlhtTenantOpenforService;

    /**
     * 返回运营商内部反向互联开通的第三方互联互通列表
     * @return
     */
    @RequestMapping(value = "/listPageHlhtTenantOpen", method = RequestMethod.GET)
    @ResponseBody
    public WebPageInfo listPageHlhtTenantOpen(HlhtTenantOpenforSearch hlhtTenantOpenforSearch) {

        //当互联互通关系的结束时间小于当前时间，将该关系设置为过期状态
        PageInfo<HlhtTenantOpenfor> pageInfo = hlhtTenantOpenforService.listPageHlhtTenantOpenfor(hlhtTenantOpenforSearch);
        WebPageInfo webPageInfo = new WebPageInfo(pageInfo.getList(), Long.valueOf(pageInfo.getTotal()).intValue());
        return webPageInfo;

    }
}
